@using System.Linq
@using MudBlazor.Docs.Extensions


<MudText Typo="Typo.subtitle1" Class="mt-1 mb-2 ml-2 d-flex d-md-none"><b>Docs</b></MudText>
<MudNavLink Href="docs/overview" Class="docs-single-link">Overview</MudNavLink>
<MudNavGroup Title="Components" Expanded="@(_section == "components")" ExpandIcon="@Icons.Material.Filled.ExpandMore">
    @foreach (var item in MenuService.Components)
    {
        if (item.IsNavGroup)
        {
            <MudNavGroup Title="@item.Name" Expanded="@(IsSubGroupExpanded(item))" ExpandIcon="@Icons.Material.Filled.ExpandMore">
                @foreach (var subItem in item.GroupComponents)
                {
                    string href = $"components/{subItem.Link}";
                    <MudNavLink Href="@href">@subItem.Name</MudNavLink>
                }
            </MudNavGroup>
        }
        else
        {
            string href = $"components/{item.Link}";
            <MudNavLink Href="@href">@item.Name</MudNavLink>
        }
    }
</MudNavGroup>
<MudNavGroup Title="API" Expanded="@(_section == "api")" ExpandIcon="@Icons.Material.Filled.ExpandMore">
    @foreach (var item in MenuService.Api.OrderBy(x => x.Name))
    {
        <MudNavLink Href="@ApiLink.GetApiLinkFor(item.Type)">@item.Name</MudNavLink>
    }
</MudNavGroup>
<MudNavGroup Title="Features" Expanded="@(_section == "features")" ExpandIcon="@Icons.Material.Filled.ExpandMore">
    @foreach (var link in MenuService.Features)
    {
        <MudNavLink Href="@link.Href">@link.Title</MudNavLink>
    }
</MudNavGroup>
 <MudNavGroup Title="Customization" Expanded="@(_section == "customization")" ExpandIcon="@Icons.Material.Filled.ExpandMore">
     @foreach (var link in MenuService.Customization)
     {
         <MudNavLink Href="@link.Href">@link.Title</MudNavLink>
     }
 </MudNavGroup>